package com.xinfan.io.buffered;

import com.xinfan.io.reader.FileReader_;
import org.junit.jupiter.api.Test;

/**
 * @Author xin
 * @Date 2022/6/8 19:16
 * @Version 1.0
 */
public class BufferedReader_ extends Reader_{

    private Reader_ reader_;

    public BufferedReader_(Reader_ reader_) {
        this.reader_ = reader_;
    }

    public void readFiles(int num) {
        for (int i = 0; i < num; i++) {
            reader_.readFile();
        }
    }
    public void readStrings(int num) {
        for (int i = 0; i < num; i++) {
            reader_.readString();
        }
    }


    public static void main(String[] args) {
        BufferedReader_ bufferedReader_ = new BufferedReader_(new StringReader_());
        bufferedReader_.readStrings(10);
    }


    @Override
    public void read() {

    }
}




abstract class Reader_{
    public void readFile(){}

    public void readString(){}

    public abstract void read();

}

class FileReader1 extends Reader_{

    public void readFile(){
        System.out.println("文件读取流");
    }

    @Override
    public void read() {

    }

}

class StringReader_ extends Reader_{

    public void readString(){
        System.out.println("字符串读取流");
    }

    @Override
    public void read() {

    }

}